home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-17 / prbgi095.zip / C.ZIP / PRTGRAPH.H < prev    next >
C/C++ Source or Header  |  1992-06-17  |  11KB  |  245 lines

  1. /*
  2.    Printer BGI driver C interface
  3.    Copyright (c) 1991 A. Resztak
  4.  */
  5.  /*   Header file */
  6.  
  7. #if   !defined(__LARGE__) && !defined(__HUGE__)
  8.    #error PRTgraph library will run only in LARGE memory model.
  9. #endif
  10.  
  11. #if   !defined(_PRT__pascal)
  12.       #define  _PRT__pascal
  13. #endif
  14.  
  15.  
  16.  #define PRT_NO_MEMORY           1
  17.  #define PRT_WRONG_PARAMETERS    2
  18.  #define PRT_NOT_INITIALIZED     3
  19.  #define PRT_IO_ERROR            4
  20.  #define PRT_ERROR               5
  21.  
  22.  
  23.  /*   drivers  */
  24.  
  25.  #define STAR_SR9    0  /* Epson ????, Star SR  */
  26.  #define IBM9        1     /* IBM GraphPrinter, ProPrinter  */
  27.  #define EPSON9      1     /* EPSON,CITIZEN ( graphic mode: Esc,'K'/'L'/'Y'/'Z' ) */
  28.  #define EPSON9II    2     /* EPSON,CITIZEN ( graphic mode: Esc,'*',n )     */
  29.  #define PANASONIC9  3     /* Panasonic KX-P1124 - not tested */
  30.  #define IBM9c       4     /* IBM ProPrinter (color) */
  31.  #define EPSON9c     4     /* EPSON (color) (graphic mode: Esc,'K'/'L'/'Y'/'Z') */
  32.  #define EPSON9IIc   5     /* EPSON (color) - (graphic mode: Esc,'*',n) */
  33.  #define EPSON24     6     /* 24 pins EPSON compatible printer */
  34.  #define IBM24       7     /* 24 pins IBM compatible printer */
  35.  #define EPSON24c    8     /* 24 pins EPSON compatible color printer */
  36.                            /*  not tested */
  37.  #define IBM24c      9     /* 24 pins IBM compatible color printer */
  38.                            /*  not tested */
  39.  #define PaintJet    10    /* general Paint Jet  */
  40.  #define HPPaintJet  11    /* HP Paint Jet */
  41.  #define LaserJet    12    /* Laser Jet    */
  42.  #define HPLJII      13    /* HP Laser Jet */
  43.  /* #define HPLJIII     11  */
  44.  /* #define POSTSCRIPT  12  */
  45.  /* #define ROLANDP  13     */
  46.  
  47.  /* modes for particular drivers */
  48.    /* EPSON9   */
  49.       #define  EPSON9_60x72      0
  50.       #define  EPSON9_120x72     1
  51.       #define  EPSON9_120x216    2
  52.       #define  EPSON9_240x216    3
  53.    /* STAR_SR9    */
  54.       #define  STAR_SR9_60x72        0
  55.       #define  STAR_SR9_120x72       1
  56.       #define  STAR_SR9_120x144      2
  57.       #define  STAR_SR9_240x144      3
  58.    /* IBM9     */
  59.       #define  IBM9_60x72        0
  60.       #define  IBM9_120x72       1
  61.       #define  IBM9_120x216      2
  62.       #define  IBM9_240x216      3
  63.    /* EPSON24  */
  64.       #define  EPSON24_60x180     0
  65.       #define  EPSON24_120x180    1
  66.       #define  EPSON24_180x180    2
  67.       #define  EPSON24_360x180    3
  68.       #define  EPSON24_360x360    4
  69.    /* IBM24    */
  70.       #define  IBM24_60x180     0
  71.       #define  IBM24_120x180    1
  72.       #define  IBM24_180x180    2
  73.       #define  IBM24_360x180    3
  74.    /* PaintJet   */
  75.       #define  PaintJet_90x90        0
  76.       #define  PaintJet_180x180      1
  77.       #define  PaintJet_90x90c       2
  78.       #define  PaintJet_180x180c     3
  79.    /* HPPJ   */
  80.       #define  HPPJ_90x90        0
  81.       #define  HPPJ_180x180      1
  82.       #define  HPPJ_90x90c       2
  83.       #define  HPPJ_180x180c     3
  84.    /* LaserJet   */
  85.       #define  LaserJet_75x75        0
  86.       #define  LaserJet_100x100      1
  87.       #define  LaserJet_150x150      2
  88.       #define  LaserJet_300x300      3
  89.    /* HPLJII   */
  90.       #define  HPLJII_75x75        0
  91.       #define  HPLJII_100x100      1
  92.       #define  HPLJII_150x150      2
  93.       #define  HPLJII_300x300      3
  94.  
  95.  
  96.  /*   F U N C T I O N S    P R O T O T Y P E S  */
  97.  
  98. #define  PRT__FAR_DATA    /* far */
  99. #define  PRT__FAR_PTR        far
  100. #define  PRT__FAR_PROC    far
  101. #if !ForPascal
  102.     #define  PRT__HUGE_PROC   huge
  103. #else
  104.     #define  PRT__HUGE_PROC   far
  105. #endif
  106.  
  107.  
  108. #ifdef __cplusplus
  109. extern "C" {
  110. #endif
  111.  
  112. int PRT__HUGE_PROC pascal PRT_SetDriver ( unsigned drv, unsigned mode,
  113.                                      unsigned width, unsigned height,
  114.                                      unsigned options );
  115.    #define  PRT_NORMAL     0
  116.    #define  PRT_ROTATE     1
  117.    #define  PRT_INVERSE    2
  118.    #define  PRT_REVERSE    2
  119.  
  120. // #if ForPascal
  121.    typedef int far *PRT__handleT; /* pointer to Pascal File */
  122. // #else
  123. //   typedef int   PRT__handleT;
  124. // #endif
  125.  
  126.  /* Procedures which may be called before initializing PBGI */
  127. int PRT__HUGE_PROC pascal PRT_Buffer ( void far *address, long size, int usable );
  128. int PRT__HUGE_PROC pascal PRT_EMSBuffer ( int EMShandle, long size, int usable );
  129. int PRT__HUGE_PROC pascal PRT_XMSBuffer ( int XMShandle, long size, int usable );
  130. int   PRT__HUGE_PROC pascal   PRT_SetBuffer ( long size, unsigned BufOpt );
  131.       #define  NotUseEMS   1
  132.       #define  NotUseXMS   2
  133.  // int PRT__HUGE_PROC pascal PRT_DefineWorld ( unsigned MaxX, unsigned MaxY );
  134.  int  PRT__HUGE_PROC pascal   PRT_SetOutName ( const char PRT__FAR_PTR * DeviceName );
  135.  int  PRT__HUGE_PROC pascal   PRT_SetMargins ( int left, int top );
  136.  int  pascal PRT__HUGE_PROC   PRT_RescaleFillPattern ( int r );
  137.                         /* 0 = never, 1 = always , -1 = at high densities only */
  138.  
  139.  /* Procedure allocates PRT buffer, initializes PBGI, calls Draw(),
  140.     closes PBGI, prints picture, and frees the buffer.
  141.     All above is done neccesary number of times to print
  142.     entire picture. */
  143. int PRT__HUGE_PROC pascal PRT_PrintBGI (
  144.                               int far * graphdriver, int far *graphmode,
  145.                               const char far *pathtodriver,
  146.                               int ( _PRT__pascal PRT__HUGE_PROC  (*Draw)
  147.                                   (void PRT__FAR_PTR * UserPointer) ),
  148.                               void PRT__FAR_PTR* UserPointer );
  149.  
  150.        /* Various informing procedures */
  151.    /* May be allways called   */
  152.  int  PRT__HUGE_PROC pascal   PRT_MaxDriver ( void );
  153.  int  PRT__HUGE_PROC pascal   PRT_DriverName ( unsigned driverno, char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr  );
  154.  int  PRT__HUGE_PROC pascal   PRT_MaxMode ( unsigned driverno, int PRT__FAR_PTR *maxmode );
  155.  int  PRT__HUGE_PROC pascal   PRT_ModeName ( unsigned driverno, int modeno,
  156.                         char PRT__FAR_PTR * PRT__FAR_PTR * name_ptr );
  157.  int  PRT__HUGE_PROC pascal   PRT_DriverNo ( void );
  158.  int  PRT__HUGE_PROC pascal   PRT_ModeNo ( void );
  159.  char far * PRT__HUGE_PROC pascal   PRT_grapherrormsg ( int errorcode );
  160.  
  161.    /*  May be called only after PRT_SetDriver */
  162.  long PRT__HUGE_PROC pascal   PRT_BufferNeeded ( int x1, int y1, int x2, int y2 );
  163.  long PRT__HUGE_PROC pascal   PRT_XMSBufferNeeded ( int x1, int y1, int x2, int y2 );
  164.  int  PRT__HUGE_PROC pascal   PRT_Resolution ( int PRT__FAR_PTR *Xres, int PRT__FAR_PTR *Yres );
  165.  
  166.  
  167.  /* Procedure initializes PBGI, calls Draw(), closes PBGI,
  168.     DOES NOT print picture, and DOES NOT allocate or free the buffer */
  169. int PRT__HUGE_PROC pascal  PRT_BuildBitMap (
  170.                               int far * graphdriver, int far *graphmode,
  171.                               const char far *pathtodriver,
  172.                               int x1,int y1, int x2,int y2,
  173.                               int ( _PRT__pascal PRT__HUGE_PROC  (*Draw)
  174.                                   (void PRT__FAR_PTR * UserPointer) ),
  175.                               void PRT__FAR_PTR* UserPointer );
  176.  
  177. #if ForPascal
  178.    int PRT__HUGE_PROC pascal PRT_Send( const char far *s);
  179. #else
  180.    int PRT__HUGE_PROC pascal PRT_Send( const char far *s, unsigned slen);
  181. #endif
  182.  
  183. /* Procedures which may be called before freeing the buffer */
  184. int PRT__HUGE_PROC pascal PRT_InitPrt ( PRT__handleT handle );
  185. int PRT__HUGE_PROC pascal PRT_EndPrt ( PRT__handleT handle );
  186. int PRT__HUGE_PROC pascal PRT_PrintBuffer (PRT__handleT handle);
  187.  
  188. unsigned PRT__HUGE_PROC pascal  PRT_getpixel ( int x, int y );
  189. void  PRT__HUGE_PROC pascal   setfillpattern16 ( char PRT__FAR_PTR * upattern, int color );
  190. void  PRT__HUGE_PROC pascal   getfillpattern16 ( char PRT__FAR_PTR * upattern );
  191. void  PRT__HUGE_PROC pascal   setcharsize_Inch (int width, int height);
  192.       /* Sets char size in 1/1000 inch but is version dependent.
  193.          Might cause link errors in versions other than BC++ 2.0 or 3.0 */
  194. void  PRT__HUGE_PROC pascal   setcharsize_Pix (int width, int height);
  195.  
  196. int   PRT__HUGE_PROC pascal   PRT_AllocateBuffer ( void );
  197. int   PRT__HUGE_PROC pascal   PRT_FreeBuffer (void);
  198.  
  199.  
  200.    int PRT__HUGE_PROC pascal PRT_installuserdriver ( const char far * name, int huge (*detect)(void) );
  201.    int PRT__HUGE_PROC pascal PRT_registerfarbgidriver ( void far pascal (*driver)(void) );
  202.    int PRT__HUGE_PROC pascal PRT_Unregisterfarbgidriver ( void far pascal(*driver)(void) );
  203.    int PRT__HUGE_PROC pascal PRT_SetViewSize( int x1, int y1, int x2, int y2 );
  204.    int PRT__HUGE_PROC pascal PRT_initgraph( int far * graphdriver, int far *graphmode,
  205.                                        const char far *pathtodriver );
  206.    int PRT__HUGE_PROC pascal PRT_closegraph(void); /* DOES NOT free the buffer   */
  207.  
  208.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_ErrorFuncP) ( PRT__handleT handle );
  209.    typedef PRT__handleT _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_OpenFuncP)( const char far* outname );
  210.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_CloseFuncP)( PRT__handleT handle );
  211.    typedef int _PRT__pascal ( PRT__HUGE_PROC * pascal PRT_WriteFuncP)( PRT__handleT handle, const void PRT__FAR_PTR * b,
  212.                                                            unsigned len );
  213. PRT_ErrorFuncP PRT__HUGE_PROC pascal PRT_SetErrorFunc ( int far _PRT__pascal WrErrFunc(PRT__handleT handle) );
  214. PRT_OpenFuncP  PRT__HUGE_PROC pascal PRT_SetOpenFunc  ( PRT__handleT far _PRT__pascal f(const char far* outname) );
  215. PRT_CloseFuncP PRT__HUGE_PROC pascal PRT_SetCloseFunc ( int far _PRT__pascal f(PRT__handleT handle) );
  216. PRT_WriteFuncP PRT__HUGE_PROC pascal PRT_SetWriteFunc ( int far _PRT__pascal
  217.                                                   f(PRT__handleT handle,
  218.                                                     const void PRT__FAR_PTR * b,
  219.                                                     unsigned len) );
  220.  
  221.  
  222. int pascal CloseCallerBGI ( void );
  223. int pascal RestoreCallerBGI ( int far * graphdriver, int far *graphmode,
  224.                               const char far *pathtodriver );
  225.  
  226. extern void far pascal BitImage(void);  /* link our bit image BGI driver */
  227.  
  228. #ifdef __cplusplus
  229.    }
  230. #endif
  231.  
  232.  
  233. #ifdef __cplusplus
  234. extern "C" {
  235. #endif
  236.       PRT__handleT _PRT__pascal __PRT_Open(const char far* outname);
  237.       int          _PRT__pascal __PRT_Close( PRT__handleT handle );
  238.       int          _PRT__pascal __PRT_Write( PRT__handleT handle, const void PRT__FAR_PTR * b, unsigned len );
  239. #ifdef __cplusplus
  240.            }
  241. #endif
  242.  
  243.  
  244.    /* end of PRTGRAPH.H  */
  245.